Add the Josh's front end for Windows.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 3 Dec 2002 22:25:28 +0000 (22:25 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 3 Dec 2002 22:25:28 +0000 (22:25 +0000)
gpsbabel/win32/README [new file with mode: 0644]
gpsbabel/win32/gpsbabelfront.dpr [new file with mode: 0644]
gpsbabel/win32/gpsbabelfront.exe [new file with mode: 0644]
gpsbabel/win32/gpsbabelfront_mainform.dfm [new file with mode: 0644]
gpsbabel/win32/gpsbabelfront_mainform.pas [new file with mode: 0644]

diff --git a/gpsbabel/win32/README b/gpsbabel/win32/README
new file mode 100644 (file)
index 0000000..132c2c7
--- /dev/null
@@ -0,0 +1,5 @@
+
+This is a Windows front-end for GPSBabel.  It was contributed and is
+maintained by Josh McKee.   It is written in Delphi.
+
+
diff --git a/gpsbabel/win32/gpsbabelfront.dpr b/gpsbabel/win32/gpsbabelfront.dpr
new file mode 100644 (file)
index 0000000..2c08b01
--- /dev/null
@@ -0,0 +1,14 @@
+program gpsbabelfront;\r
+\r
+uses\r
+  Forms,\r
+  gpsbabelfront_mainform in 'gpsbabelfront_mainform.pas' {FormGPSBabelFront};\r
+\r
+{$R *.res}\r
+\r
+begin\r
+  Application.Initialize;\r
+  Application.Title := 'GPSBabel Front End';\r
+  Application.CreateForm(TFormGPSBabelFront, FormGPSBabelFront);\r
+  Application.Run;\r
+end.\r
diff --git a/gpsbabel/win32/gpsbabelfront.exe b/gpsbabel/win32/gpsbabelfront.exe
new file mode 100644 (file)
index 0000000..2616653
Binary files /dev/null and b/gpsbabel/win32/gpsbabelfront.exe differ
diff --git a/gpsbabel/win32/gpsbabelfront_mainform.dfm b/gpsbabel/win32/gpsbabelfront_mainform.dfm
new file mode 100644 (file)
index 0000000..3648002
--- /dev/null
@@ -0,0 +1,126 @@
+object FormGPSBabelFront: TFormGPSBabelFront\r
+  Left = 208\r
+  Top = 103\r
+  BorderStyle = bsDialog\r
+  Caption = 'GPSBabel GUI Frontend'\r
+  ClientHeight = 212\r
+  ClientWidth = 369\r
+  Color = clBtnFace\r
+  Font.Charset = DEFAULT_CHARSET\r
+  Font.Color = clWindowText\r
+  Font.Height = -11\r
+  Font.Name = 'MS Sans Serif'\r
+  Font.Style = []\r
+  OldCreateOrder = False\r
+  Position = poScreenCenter\r
+  OnCreate = FormCreate\r
+  DesignSize = (\r
+    369\r
+    212)\r
+  PixelsPerInch = 96\r
+  TextHeight = 13\r
+  object Label1: TLabel\r
+    Left = 8\r
+    Top = 192\r
+    Width = 250\r
+    Height = 13\r
+    Anchors = [akLeft, akBottom]\r
+    Caption = 'GPSBabel: http://sourceforge.net/projects/gpsbabel'\r
+  end\r
+  object Label2: TLabel\r
+    Left = 8\r
+    Top = 16\r
+    Width = 43\r
+    Height = 13\r
+    Caption = 'Input file:'\r
+  end\r
+  object Label3: TLabel\r
+    Left = 8\r
+    Top = 80\r
+    Width = 51\r
+    Height = 13\r
+    Caption = 'Output file:'\r
+  end\r
+  object Bevel1: TBevel\r
+    Left = -3\r
+    Top = 185\r
+    Width = 380\r
+    Height = 2\r
+    Anchors = [akLeft, akBottom]\r
+  end\r
+  object comboInput: TComboBox\r
+    Left = 64\r
+    Top = 40\r
+    Width = 297\r
+    Height = 21\r
+    Style = csDropDownList\r
+    ItemHeight = 13\r
+    TabOrder = 2\r
+  end\r
+  object editInput: TEdit\r
+    Left = 64\r
+    Top = 16\r
+    Width = 273\r
+    Height = 21\r
+    TabOrder = 0\r
+  end\r
+  object editOutput: TEdit\r
+    Left = 64\r
+    Top = 80\r
+    Width = 273\r
+    Height = 21\r
+    TabOrder = 3\r
+  end\r
+  object comboOutput: TComboBox\r
+    Left = 64\r
+    Top = 104\r
+    Width = 297\r
+    Height = 21\r
+    Style = csDropDownList\r
+    ItemHeight = 13\r
+    TabOrder = 5\r
+  end\r
+  object btnProcess: TButton\r
+    Left = 288\r
+    Top = 152\r
+    Width = 75\r
+    Height = 25\r
+    Caption = 'Process'\r
+    TabOrder = 7\r
+    OnClick = btnProcessClick\r
+  end\r
+  object cbIgnoreShort: TCheckBox\r
+    Left = 64\r
+    Top = 136\r
+    Width = 169\r
+    Height = 17\r
+    Caption = 'Ignore "short" names'\r
+    TabOrder = 6\r
+  end\r
+  object btnInput: TButton\r
+    Left = 341\r
+    Top = 16\r
+    Width = 19\r
+    Height = 21\r
+    Caption = '...'\r
+    TabOrder = 1\r
+    OnClick = btnInputClick\r
+  end\r
+  object btnOutput: TButton\r
+    Left = 341\r
+    Top = 80\r
+    Width = 19\r
+    Height = 21\r
+    Caption = '...'\r
+    TabOrder = 4\r
+    OnClick = btnOutputClick\r
+  end\r
+  object OpenDialogInput: TOpenDialog\r
+    Left = 80\r
+    Top = 8\r
+  end\r
+  object SaveDialogOutput: TSaveDialog\r
+    Left = 80\r
+    Top = 72\r
+  end\r
+end\r
diff --git a/gpsbabel/win32/gpsbabelfront_mainform.pas b/gpsbabel/win32/gpsbabelfront_mainform.pas
new file mode 100644 (file)
index 0000000..7dd7a9d
--- /dev/null
@@ -0,0 +1,217 @@
+{
+
+               Copyright (C) 2002 Josh M. McKee, geo@mrsnazz.com
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+}
+
+unit gpsbabelfront_mainform;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+  Dialogs, ExtCtrls, StdCtrls;
+
+const
+       FormatCount = 18;
+
+type
+       TFormat = record
+       sType:string; // type to be passed to GPSBabel
+    sExt:string;  // default file extension
+    sDesc:string; // description of format
+  end;
+
+  TFormGPSBabelFront = class(TForm)
+    Label1: TLabel;
+    Label2: TLabel;
+    Label3: TLabel;
+    comboInput: TComboBox;
+    editInput: TEdit;
+    editOutput: TEdit;
+    comboOutput: TComboBox;
+    btnProcess: TButton;
+    cbIgnoreShort: TCheckBox;
+    Bevel1: TBevel;
+    btnInput: TButton;
+    btnOutput: TButton;
+    OpenDialogInput: TOpenDialog;
+    SaveDialogOutput: TSaveDialog;
+    procedure FormCreate(Sender: TObject);
+    procedure btnInputClick(Sender: TObject);
+    procedure btnOutputClick(Sender: TObject);
+    procedure btnProcessClick(Sender: TObject);
+  private
+    { Private declarations }
+  public
+    { Public declarations }
+    formats:array[0..FormatCount-1] of TFormat;
+
+    procedure PopulateCombos;
+    procedure PopulateDialogs;
+  end;
+
+var
+  FormGPSBabelFront: TFormGPSBabelFront;
+
+implementation
+
+{$R *.dfm}
+
+procedure TFormGPSBabelFront.PopulateCombos;
+var
+       i:integer;
+begin
+       for i:=0 to FormatCount-1 do begin
+       comboInput.items.add(formats[i].sDesc);
+    comboOutput.items.add(formats[i].sDesc);
+  end;
+end;
+
+procedure TFormGPSBabelFront.PopulateDialogs;
+var
+       i:integer;
+begin
+       OpenDialogInput.Filter := '';
+  SaveDialogOutput.Filter := '';
+       for i:=0 to FormatCount-1 do begin
+               if (formats[i].sExt<>'') then begin
+       OpenDialogInput.Filter := OpenDialogInput.Filter + formats[i].sDesc + ' (*.' +
+               formats[i].sExt + ')|*.' + uppercase(formats[i].sExt) + '|';
+
+                       SaveDialogOutput.Filter := SaveDialogOutput.Filter + formats[i].sDesc + ' (*.' +
+               formats[i].sExt + ')|*.' + uppercase(formats[i].sExt) + '|';
+    end;
+  end;
+
+  OpenDialogInput.Filter := OpenDialogInput.Filter + 'All files (*.*)|*.*';
+  SaveDialogOutput.Filter := SaveDialogOutput.Filter + 'All files (*.*)|*.*';
+end;
+
+procedure TFormGPSBabelFront.FormCreate(Sender: TObject);
+begin
+       formats[0].sType := 'geo';
+  formats[0].sExt := 'loc';
+  formats[0].sDesc := 'Geocaching.com .loc';
+       formats[1].sType := 'gpsman';
+  formats[1].sExt := '';
+  formats[1].sDesc := 'GPSman';
+       formats[2].sType := 'gpx';
+       formats[2].sExt := 'gpx';
+  formats[2].sDesc := 'GPX XML';
+  formats[3].sType := 'magellan';
+  formats[3].sExt := '';
+  formats[3].sDesc := 'Magellan protocol';
+       formats[4].sType := 'mapsend';
+  formats[4].sExt := '';
+  formats[4].sDesc := 'Magellan Mapsend';
+  formats[5].sType := 'pcx';
+  formats[5].sExt := 'pcx';
+  formats[5].sDesc := 'Garmin PCX5';
+  formats[6].sType := 'mapsource';
+  formats[6].sExt := '';
+  formats[6].sDesc := 'Garmin Mapsource';
+  formats[7].sType := 'gpsutil';
+  formats[7].sExt := '';
+  formats[7].sDesc := 'gpsutil';
+  formats[8].sType := 'tiger';
+  formats[8].sExt := '';
+  formats[8].sDesc := 'U.S. Census Bureau Tiger Mapping Service';
+  formats[9].sType := 'csv';
+  formats[9].sExt := 'csv';
+  formats[9].sDesc := 'Comma separated values';
+  formats[10].sType := 'dna';
+  formats[10].sExt := 'dna';
+  formats[10].sDesc := 'Navitrak DNA marker format';
+  formats[11].sType := 'psp';
+  formats[11].sExt := 'psp';
+  formats[11].sDesc := 'MS PocketStreets 2002 Pushpin';
+       formats[12].sType := 'cetus';
+  formats[12].sExt := 'pdb';
+  formats[12].sDesc := 'Cetus for Palm/OS';
+  formats[13].sType := 'gpspilot';
+  formats[13].sExt := '';
+  formats[13].sDesc := 'GPSPilot Tracker for Palm/OS';
+  formats[14].sType := 'garmin';
+  formats[14].sExt := '';
+  formats[14].sDesc := 'Garmin serial protocol';
+       formats[15].sType := 'mxf';
+  formats[15].sExt := 'mxf';
+  formats[15].sDesc := 'MapTech Exchange Format';
+       formats[16].sType := 'holux';
+  formats[16].sExt := 'wpo';
+  formats[16].sDesc := 'Holux (gm-100) .wpo Format';
+       formats[17].sType := 'ozi';
+  formats[17].sExt := 'ozi';
+  formats[17].sDesc := 'OziExplorer Waypoint';
+
+  PopulateCombos;
+  PopulateDialogs;
+end;
+
+procedure TFormGPSBabelFront.btnInputClick(Sender: TObject);
+var
+       sExt:string;
+  i:integer;
+begin
+       if opendialoginput.Execute then begin
+       editInput.Text := opendialoginput.filename;
+    sExt := uppercase(ExtractFileExt(editInput.text));
+               for i := 0 to FormatCount-1 do begin
+       if '.' + uppercase(formats[i].sExt) = sExt then comboInput.ItemIndex := i;
+    end;
+  end;
+end;
+
+procedure TFormGPSBabelFront.btnOutputClick(Sender: TObject);
+var
+       sExt:string;
+  i:integer;
+begin
+       if savedialogoutput.Execute then begin
+       editOutput.Text := savedialogoutput.filename;
+    sExt := uppercase(ExtractFileExt(editOutput.text));
+               for i := 0 to FormatCount-1 do begin
+       if '.' + uppercase(formats[i].sExt) = sExt then comboOutput.ItemIndex := i;
+    end;
+  end;
+end;
+
+procedure TFormGPSBabelFront.btnProcessClick(Sender: TObject);
+var
+       sIgnoreShort:string;
+  sCmd:string;
+  f:file;
+begin
+       if cbIgnoreShort.checked then sIgnoreShort := '-s' else sIgnoreShort := '';
+
+  if not fileexists(editoutput.text) then begin
+               system.assign(f,editoutput.text);
+               system.rewrite(f);
+    system.close(f);
+  end;
+
+  sCmd := 'GPSBabel '+sIgnoreShort+' -i '+formats[comboInput.itemindex].sType+' -f '+
+       ExtractShortPathName(editInput.text)+' -o '+formats[comboOutput.itemindex].sType+' -F '+
+    ExtractShortPathName(editOutput.text) + ' > result.txt';
+
+       WinExec(pchar(sCmd),SW_SHOW);
+end;
+
+end.
+
+